/**
 * 
 */
package com.itboye.allshengmedical.sci.cmd.req;

import com.itboye.allshengmedical.sci.packet.req.SetTempReqPacket;

import android.R.bool;
import android.R.integer;
import android.util.Log;

/**
 * @author 贝贝 346551990@qq.com
 * @date 2016-12-8
 */
public class CmdFactory {

	/**
	 * 创建指令对象
	 * 
	 * @param cmdType
	 * @return
	 */
	public static IReqCommand create(CmdType cmdType, String todo, int temp) {
		IReqCommand reqCommand = null;
		switch (cmdType) {
		case SelfCheck:
			reqCommand = new SelfCheckCmd();
			break;
		case Version:
			reqCommand = new VersionCmd();
			break;
		case SetTemp:
			if (todo.equals("NoCtrl")) {
				reqCommand = new SetNoTempCmd();
			} else if (todo.equals("CtrlTemp1")) {
				SetTempCmd1 setTempCmd = new SetTempCmd1(temp);
				reqCommand = setTempCmd;
			} else if (todo.equals("CtrlTemp2")) {
				SetTempCmd2 setTempCmd = new SetTempCmd2(temp);
				reqCommand = setTempCmd;
			} else if (todo.equals("CtrlTemp3")) {
				SetTempCmd3 setTempCmd = new SetTempCmd3(temp);
				reqCommand = setTempCmd;
			}
			break;
		case StopCtrlTemp:
			if ("StayTemp".equals(todo)) {
				reqCommand = new StayCtrlTempCmd();
			} else if ("StopTemp1".equals(todo)) {
				reqCommand = new StopCtrlTemp1();
			} else if ("StopTemp2".equals(todo)) {
				reqCommand = new StopCtrlTemp2();
			} else if ("StopTemp3".equals(todo)) {
				reqCommand = new StopCtrlTemp3();
			}
			break;
		case GetTemp:
			reqCommand = new GetTempCmd();
			break;
		case EnterVerifyTemp:
			if ("start".equals(todo)) {
				reqCommand = new EnterVerifyTempCmd();
			} else {
				reqCommand = new EndVerifyTempCmd();
			}
			break;
		case DetectLightIntensitTemp:
			reqCommand = new DetectLightIntensitTempCmd(temp);
			break;
		case LightJustTemp:
			reqCommand = new LightJustCmd(temp);
			break;
		case OpenLight:
			reqCommand = new OpenLightCmd(temp);
			break;
		case CloseLight:
			reqCommand = new CloseLightCmd(temp);
			break;
		case UpdateArm:
			if ("start".equals(todo)) {
				reqCommand = new UpdateArmCmd(temp);
			} else if ("end".equals(todo)) {
				reqCommand = new EndUpdateArmCmd(temp);
			}
			break;
		case FinishExpriment:
			reqCommand = new FinishExprimentCmd();
			break;
		case AreaCalibration:
			if ("01".equals(todo)) {
				reqCommand = new AreaCalibration1Cmd(temp);
			} else if ("02".equals(todo)) {
				reqCommand = new AreaCalibration2Cmd(temp);
			} else if ("03".equals(todo)) {
				reqCommand = new AreaCalibration3Cmd(temp);
			} else if ("04".equals(todo)) {
				reqCommand = new AreaCalibration4Cmd(temp);
			} else if ("05".equals(todo)) {
				reqCommand = new AreaCalibration5Cmd(temp);
			}
			break;
		case EndAreaCalibration:
			reqCommand = new EndAreaCalibrationCmd();
			break;
		case RunCmd:
			reqCommand = new RunMethodCmd();
			break;
		default:
			break;
		}

		return reqCommand;
	}

	public static IReqCommand create(CmdType cmdType, String todo, int temp, int temp2, int temp3, int temp4) {
		IReqCommand reqCommand = null;
		switch (cmdType) {
		case VerifyTemp:
			if ("VerifyTemp1".equals(todo)) {
				reqCommand = new VerifyTempCtrlOneCmd(temp, temp2, temp3, temp4);
			} else if ("VerifyTemp2".equals(todo)) {
				reqCommand = new VerifyTempCtrlTwoCmd(temp, temp2, temp3, temp4);
			} else if ("VerifyTemp3".equals(todo)) {
				reqCommand = new VerifyTempCtrlThreeCmd(temp, temp2, temp3, temp4);
			}
			break;
		case SetTemp:
			reqCommand = new SetAllTempCmd(temp, temp2, 0, 0);
			break;
		}

		return reqCommand;
	}

	public static void main(String[] args) {
	}
}
